package example.mybatis.catalog.test;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.scaffold.catalog.entity.Catalog;

@Service
@Transactional(rollbackFor = Exception.class)
public class CatalogBatisService {

	@Autowired
	private CatalogBatisDAO catalogDAO;
	
	public void save(Catalog catalog){
		catalogDAO.save(catalog);
	}
	
	public Catalog getCatalog(Long id){
		return catalogDAO.findById(id);
	}
	
	public List<Catalog> query(){
		return catalogDAO.findAll();
	}

}
